package com.xy.farm.activity.farm.adapter;

import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.xy.farm.R;
import com.xy.farm.activity.farm.BuyLandActivity;

public class FarmDetailsAdapter extends RecyclerView.Adapter<FarmDetailsAdapter.ViewHolder>
{
    public class ViewHolder extends RecyclerView.ViewHolder
    {
        private LinearLayout onClick;
        public ViewHolder(View view)
        {
            super(view);
            onClick = view.findViewById(R.id.onClick);
        }
    }
    @Override
    public int getItemCount()
    {
        return 4;
    }
    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
    {
        return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_farm_details, parent, false));
    }
    @Override
    public void onBindViewHolder(ViewHolder holder, int position)
    {
        holder.onClick.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                Intent intent = new Intent(view.getContext(), BuyLandActivity.class);
                view.getContext().startActivity(intent);
            }
        });
    }
}
